@extends('admin.master')

@section('top')
<div class="top-breadcrumb pull-left">{!! Breadcrumbs::render('user-create') !!}</div>
@endsection

@section('content')
<div class="container-body">
{!! Form::open(['route' => 'admin.user.store', 'class'=>'form-horizontal']) !!}
	<input type="hidden" name="password" value="123456">
	<div class="form-group">
		<label class="col-sm-4 control-label label-width"><span class="text-danger">*</span> 用户名</label>
		<div class="col-sm-8 row">
			{!! Form::text('username', null, ['class'=>'form-control len', 'data-rule'=>'required;remote(/admin/user/check-username)']) !!}
		</div>
	</div>
	<div class="form-group">
		<label class="col-sm-4 control-label label-width"><span class="text-danger">*</span> 姓名</label>
		<div class="col-sm-8 row">
			{!! Form::text('name', null, ['class'=>'form-control len', 'data-rule'=>'required']) !!}
		</div>
	</div>
	<div class="form-group">
		<label class="col-sm-4 control-label label-width">手机号码</label>
		<div class="col-sm-8 row">
			{!! Form::text('phone', null, ['class'=>'form-control len', 'data-rule'=>'required']) !!}
		</div>
	</div>
	<div class="form-group">
		<label class="col-sm-4 control-label label-width">邮箱</label>
		<div class="col-sm-8 row">
			{!! Form::text('email', null, ['class'=>'form-control len', 'data-rule'=>'required;remote(/admin/user/check-email)']) !!}
		</div>
	</div>
	<div class="form-group">
		<label class="col-sm-4 control-label label-width">QQ</label>
		<div class="col-sm-8 row">
			{!! Form::text('qq', null, ['class'=>'form-control len']) !!}
		</div>
	</div>
	<div class="form-group">
		<label class="col-sm-4 control-label label-width">职位</label>
		<div class="col-sm-8 row">
			{!! Form::text('job', null, ['class'=>'form-control len']) !!}
		</div>
	</div>
	<div class="form-group">
		<label class="col-sm-4 control-label label-width">所属部门</label>
		<div class="col-sm-8 row">
			<div class="department-select" id="department">
				<select name="region_id" class="form-control len150 region" data-rule='integer(+)', data-msg='请选择区域'></select>
				<select name="department_id" class="form-control len150 department"></select>
			</div>
		</div>
	</div>
	<div class="form-group">
		<label class="col-sm-4 control-label label-width"><span class="text-danger">*</span> 用户组</label>
		<div class="col-sm-8 row">
			{!! Form::select('gid', $group, 4, ['class'=>'form-control len']) !!}
		</div>
	</div>
		<div class="form-group">
			<label class="col-sm-4 control-label label-width"></label>
			<div class="col-sm-8 row">
				{!! Form::submit('提交', ['class'=>'btn btn-primary']) !!}
			</div>
		</div>
{!! Form::close() !!}
</div>
@endsection

@section('foot')
<script src="{{ url('js/nice-validator/jquery.validator.js?local=zh-CN') }}"></script>
<script src="{{ url('js/department.js') }}"></script>
<script type="text/javascript">
	var departments = {!! json_encode($departmentsTree, JSON_UNESCAPED_UNICODE) !!};

	department.init({
		regions: departments,
		departments: departments
	}).make();
</script>	
@endsection